#ifndef STARTUPWIDGET_H
#define STARTUPWIDGET_H

#include <QWidget>
#include <messaginglayer/cauthinfo.h>

class QEvent;

namespace Ui {
    class StartupForm;
}

class StartupWidget : public QWidget
{
    Q_OBJECT

public:
    enum State {Idle, Connecting};
    explicit StartupWidget(QWidget *parent = 0);
    ~StartupWidget();

    void setProgressMessage(const QString &text, bool isError = false);

signals:
    void connectionRequest(const CAuthInfo&);

public slots:
    void connected();
    void connectionError(const QString&);

private slots:
    void logInOrAbort();
    void clearErrorText();

protected:
    bool event(QEvent *e);

private:    
    void connectProfile();
    void abortConnecting();
    void updateKeyboardLayoutIndicator();
    void changeState(State state);

    Ui::StartupForm *ui;
    State m_state;
};

#endif // STARTUPWIDGET_H
